%%% ====================================================================
%%%  @LaTeX-style-file{
%%%     author          = "Geoffrey R. D. Tobin",
%%%     version         = "1.0",
%%%     date            = "23 Jan 1992",
%%%     time            = "15:56:00 AEDT (06:56:00 GMT)",
%%%     filename        = "set_sp.sty",
%%%     address         = "Department of Electronic Engineering
%%%                        La Trobe University
%%%                        Bundoora VIC 3083
%%%                        Australia",
%%%     telephone       = "+ 613 479-1180",
%%%     checksum        = "06002 253 1152 10466"
%%%     email           = "ecsgrt@luxor.latrobe.edu.au (Internet)",
%%%     codetable       = "ISO/ASCII",
%%%     keywords        = "LaTeX, linespacing, NFSS",
%%%     supported       = "yes, by email",
%%%     docstring       = "The checksum field above contains a CRC-16
%%%                        checksum as the first value, followed by
%%%                        the equivalent of the standard UNIX wc
%%%                        (word count) utility output of lines,
%%%                        words, and characters.  This is produced by
%%%                        Robert Solovay's checksum utility.  This
%%%                        program, as well as Nelson Beebe's proposal
%%%                        for standard file headers, is available via
%%%                        anonymous ftp from math.utah.edu.",
%%%  }
%%% ====================================================================
% set_sp.sty - version 1 - 15:56 - Thu 23 Jan 1992 - Geoffrey Tobin
% `merge' of ideas of setspace.sty and of dblsp.sty mods by Mark A. Roth.
%
%% FILE:   setspace.sty in SYS2.TEX.PUB.ISULATEX.STYLES
%% AUTHOR: Erica M. S. Harris
%% DATE:   April 1990
%% DESCR:  LaTeX Document style option "setspace"
%%         Usage:  \documentstyle[...,setspace,...]{...}
%%         Based on the doublespace option created by Stephen Page.
%%
%%         This style option provides commands and environments for doing
%%         double and  one-and-a-half spacing based on pt size.
%%
%%         Single spacing is the default.
%%
%%         Three commands, \doublespacing, \onehalfspacing, and
%%         \singlespacing, are for use in the preamble to set the overall
%%         spacing for the document.  If a different spacing is required then
%%         the \setstretch{baselinestretch} command can be used in the
%%         preamble to set the baselinestretch appropriately.  The default
%%         spacing with this style option is single spacing.
%%
%%         Three environments, singlespace, onehalfspace, and doublespace,
%%         allow the spacing to be changed within the document.  Both the
%%         onehalfspace and doublespace environments are intended to increase
%%         the spacing, so the onehalfspace environment should not be used in
%%         a double spaced document.  If an increased spacing different from
%%         one-and-a-half or double spacing is required then the spacing
%%         environment can be used.  The spacing environment takes one
%%         argument which is the larger baselinestretch to use,
%%         e.g., \begin{spacing}{2.5}.
%%
%%         \footins is adjusted the same as \parskip - appears to work. Lose
%%         stretch parts but don't consider that to be crucial
%%
%%         Removed code for altering spacing before and after displayed
%%         equations - just looked too much.
%%
%% MODS:
%%
%% PLEASE REPORT ANY BUGS
%%
%%   Old Documentation follows:
%%         1. A new environment "singlespace" is provided, within which single
%%            spacing will apply.
%%            JFL - changed so that it works in regular text and so that
%%            vertical space before and after is correctly computed.
%%         2. Double spacing is turned off within footnotes and floats (figures
%%            and tables).
%%         3. Proper double spacing happens below tabular environments and in
%%            other places where LaTeX uses a strut.
%%         4. Slightly more space is inserted before footnotes.
%%         5. JFL - fixes spacing before and after displayed math.
%          6. MAR - fix to work with new font selection scheme if used.
%%
%     Modified by: Mark A. Roth, mroth@afit.af.mil
%%
%%    mods:   Jean-Francois Lamy
%%            lamy@ai.toronto.edu
%%            lamy@utai.uucp
%
%     Author: Stephen Page  -- sdpage@prg.oxford.ac.uk
%
%     Original ``doublespace.sty'' released  6 July 1986 - 3 September 1986
%%
%% POSSIBLE BUGS:
%%    . Increasing struts may possibly cause some other obscure part of
%%      formatting to fall over.
%%    . \begin{singlespace}\begin{quote} produces the wrong spacing before
%%      the quote (extra glue is inserted).
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
 
\def\doublespacing{\ifcase \@ptsize \relax % 10pt
    \def\baselinestretch{1.667}
  \or % 11pt
    \def\baselinestretch{1.618}
  \or % 12pt
    \def\baselinestretch{1.655}
  \fi}  % EMSH
 
\def\onehalfspacing{\ifcase \@ptsize \relax % 10pt
    \def\baselinestretch{1.25}
  \or % 11pt
    \def\baselinestretch{1.213}
  \or % 12pt
    \def\baselinestretch{1.241}
  \fi}  % EMSH
 
\def\singlespacing{\def\baselinestretch{1}}  % EMSH
 
\def\setstretch#1{\renewcommand{\baselinestretch}{#1}}
 
%---Stretch the baseline BEFORE calculating the strut size. This improves
%   spacing below tabular environments etc., probably...
%   Comments are welcomed.
%   This change not needed with new font selection scheme-MAR
 
\ifx\undefined\selectfont %then new font selection scheme not invoked-MAR
\def\@setsize#1#2#3#4{\@nomath#1 \let\@currsize#1 %
   \baselineskip #2 %
   \baselineskip\baselinestretch\baselineskip
   \parskip\baselinestretch\parskip
   \setbox\strutbox\hbox{\vrule height.7\baselineskip
      depth.3\baselineskip width\z@}%
   \skip\footins \baselinestretch\skip\footins  % EMSH
   \normalbaselineskip\baselineskip#3#4}
\else %new font selection scheme is defined, set up way to change baselines-MAR
\def\@newbaseline{ \setnew@baselineskip
    \baselineskip\baselinestretch\baselineskip
    \setbox\strutbox\hbox{\vrule\@height.7\baselineskip
    \@depth.3\baselineskip \@width\z@}%
    \normalbaselineskip\baselineskip}%  -MAR
\fi  %-MAR
 
%---Increase the space between last line of text and footnote rule.
%\skip\footins 20pt plus4pt minus4pt  % commented out by EMSH.
 
%---Reset baselinestretch within footnotes and floats.
 
\def\@xfloat#1[#2]{\ifhmode \@bsphack\@floatpenalty -\@Mii\else
   \@floatpenalty-\@Miii\fi\def\@captype{#1}\ifinner
      \@parmoderr\@floatpenalty\z@
    \else\@next\@currbox\@freelist{\@tempcnta\csname ftype@#1\endcsname
       \multiply\@tempcnta\@xxxii\advance\@tempcnta\sixt@@n
       \@tfor \@tempa :=#2\do
                        {\if\@tempa h\advance\@tempcnta \@ne\fi
                         \if\@tempa t\advance\@tempcnta \tw@\fi
                         \if\@tempa b\advance\@tempcnta 4\relax\fi
                         \if\@tempa p\advance\@tempcnta 8\relax\fi
         }\global\count\@currbox\@tempcnta}\@fltovf\fi
    \global\setbox\@currbox\vbox\bgroup
    \def\baselinestretch{1}
    \ifx\undefined\selectfont %then new font selection scheme not invoked-MAR
    \@normalsize  % EMSH mod from "\small\normalsize".
    \else %else new font selection scheme is invoked-MAR
    \@newbaseline %include new baselinestretch-MAR
    \fi %-MAR
    \boxmaxdepth\z@
    \hsize\columnwidth \@parboxrestore}
 
\long\def\@footnotetext#1{\insert\footins{\def\baselinestretch{1}\footnotesize
    \interlinepenalty\interfootnotelinepenalty
    \splittopskip\footnotesep
    \splitmaxdepth \dp\strutbox \floatingpenalty \@MM
    \hsize\columnwidth \@parboxrestore
   \edef\@currentlabel{\csname p@footnote\endcsname\@thefnmark}\@makefntext
    {\rule{\z@}{\footnotesep}\ignorespaces
      #1\strut}}}
 
% A single spaced quote (say) is done by surrounding singlespace with quote.
%
\def\singlespace{%
\vskip\baselineskip%
\def\baselinestretch{1}%
\ifx\undefined\selectfont %then new font selection scheme not invoked-MAR
\ifx\@currsize\normalsize\@normalsize\else\@currsize\fi%
\else %else new font selection scheme is invoked-MAR
\@newbaseline %include new baselinestretch-MAR
\fi %-MAR
% \vskip-\parskip%  % EMSH omitted this, so I've commented it out - gt.
\vskip-\baselineskip}
 
\def\endsinglespace{\par}
 
%  spacing, doublespace and onehalfspace all are meant to INCREASE the
%  spacing (i.e. calling onehalfspace from within doublespace will not
%  produce a graceful transition between spacings)
%
\def\spacing#1{\par%
 \begingroup  %  moved from \endspacing by PGBR 1-29-91
 \def\baselinestretch{#1}%
 \ifx\undefined\selectfont %then new font selection scheme not invoked-MAR
 \ifx\@currsize\normalsize\@normalsize\else\@currsize\fi  % MAR removed `}'.
 \else %else new font selection scheme is invoked-MAR
 \@newbaseline %include new baselinestretch-MAR
 \fi %-MAR
}  % MAR moved `}' hither.
 
\def\endspacing{\par%
 \vskip \parskip%
 \vskip \baselineskip%
 \endgroup%
 \vskip -\parskip%
 \vskip -\baselineskip%
% \begingroup %\begingroup used to be here, PGBR 1-29-91
 }
 
% one and a half spacing is 1.5 x pt size
\def\onehalfspace{\ifcase \@ptsize \relax  % 10pt
     \spacing{1.25}
   \or % 11pt
     \spacing{1.213}
   \or % 12pt
     \spacing{1.241}
   \fi}
\let\endonehalfspace=\endspacing
 
% double spacing is 2 x pt size
\def\doublespace{\ifcase \@ptsize \relax % 10pt
    \spacing{1.667}
  \or % 11pt
    \spacing{1.618}
  \or % 12pt
    \spacing{1.655}
  \fi}
\let\enddoublespace=\endspacing %first end independently added by MAR & EMSH.

% gt - EMSH chose to omit display math part that follows.
% She wrote (see above) that the "altered spacing before and after displayed
% equations ... just looked too much".
%
% Fix up spacing before and after displayed math
% (arraystretch seems to do a fine job for inside LaTeX displayed math,
% since array and eqnarray seem to be affected as expected).
% Changing \baselinestretch and doing a font change also works if done here,
% but then you have to change @setsize to remove the call to @nomath)
%
\everydisplay{
  \abovedisplayskip \baselinestretch\abovedisplayskip%
  \belowdisplayskip \abovedisplayskip%
  \abovedisplayshortskip \baselinestretch\abovedisplayshortskip%
  \belowdisplayshortskip \baselinestretch\belowdisplayshortskip}
%
% end "set_sp.sty"
%%% ====================================================================
